<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>调动申请</title>
</head>
<body>
	<script type="text/javascript">
	$(function(){
		$('#transfer_form').form('load','get_transfer');
	})
	</script>
	<script type="text/javascript">
		$(function() {
		$("#transfer_save").linkbutton(
					{
						onClick : function() {
							$("#transfer_form").form(
									"submit",
									{
										url : "save_standard",
										onSubmit : function(params) {
											return $(this).form(
													'enableValidation').form(
													'validate');
										},
										success : function(data) {
											$("#transfer_form").form("clear");
											//获取选中的面板
											var tab = $('#tt').tabs(
													'getSelected');
											//根据选中的面板获取该面板的索引
											var index = $('#tt').tabs(
													'getTabIndex', tab);
											//根据索引关闭
											if (index != 0) {
												$('#tt').tabs('close', index);
											}
											$.messager.alert("消息",
													data ? "保存成功！" : "保存失败！");
										}
									});
						}
					})
					$('#findAll_dept').combobox({
						editable : false,
						labelAlign : 'right',
						label : '调动后部门：',
						url : 'findAll_dept',
						valueField : 'deptId',
						textField : 'deptName',
					});
					$('#findAll_emp').combobox({
						editable : false,
						labelAlign : 'right',
						label : '申请人：',
						url : 'findAll_emp',
						valueField : 'empId',
						textField : 'empName',
						onSelect: function(emp){    
							$.post("findBeforeDept",{empId:emp.empId} ,function(data){
								var deptname=data.deptname
								$("#aa").textbox("setValue",deptname);
							})
					}
					});
					$('#combobox_dept').combobox({
						editable : false,
						labelAlign : 'right',
						label : '调动前部门：',
						url : 'findBeforeDept',
						valueField : 'deptId',
						textField : 'deptName',
					});
		})
	</script>
	<div class="easyui-layout" fit="true">
		<div data-options="region:'center'" align="center" style="border: none;">
			<form id="transfer_form" method="post">
				<table class="table" style="margin:10px; width: 70%" border="0" cellpadding="0" cellspacing="0">
				<thead>
					<tr align="center">
						<th colspan="5" style="font-size: 17px">调动申请单</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>
							<!-- emp_name 申请人姓名 -->
							<input id="findAll_emp" name="empId" style="width: 30%;">
							<!-- 隐藏的员工id -->
							<input name="empId"  type="hidden">
							<!-- 申请时间 -->
							<input name="transferUptime" class="easyui-textbox" 
								style="width: 30%;" label="申请时间：" readonly="readonly"></input>
							<!-- transfer_type 调动类型 -->
							<select name="transferType" class="easyui-combobox" style="width: 30%;"
									label="调动类型：" labelAlign='right' editable="false">
									<option value="TRANSFER_UP">升职</option>
									<option value="TRANSFER_TO">平调</option>
									<option value="TRANSFER_DOWN">降职</option>
							</select>
						</td>
					</tr>
					<tr>
						<td>
							<!-- transfer_starttime 调动生效日期 -->
							<input name="transferStarttime" label="调动生效日：" class="easyui-datebox" required
								style="width:30%;"  editable="false" labelWidth="101%">
							<!-- dept_name 部门名称 -->
							<input name="deptName" label="部门名称：" class="easyui-textbox" required
								style="width:30%;"  editable="false" labelWidth="101%" id="aa">
							<!-- 调动后部门 -->
							<input id="findAll_dept" name="dept2" style="width: 30%;" required>
						</td>
					</tr>
					<tr>
						<td>
							<!-- transfer_explain 调动申请说明 -->
							<input name="transferExplain" class="easyui-textbox" style="width:80%;height:100%;" label="调动申请说明："
								multiline="true" labelWidth="120%" required>
							<input name="lunchPeople" type="hidden">
						</td>
					</tr>
					<tr>
						<td style="text-align: center">
							<a id="transfer_save" class="easyui-linkbutton"
								data-options="iconCls:'icon-save',text:'暂存'"></a>
							<a id="transfer_submit" class="easyui-linkbutton"
								data-options="iconCls:'icon-submit',text:'提交'"></a>
						</td>
					</tr>
				</tbody>
				</table>
			</form>
		</div>
	</div>
</body>
</html>